
cc.Class({
  extends: cc.Component,

  properties: {  
    superTimeTxt: {
      default: null,
      type: cc.Label
    }, 
    superTimeNode: {
      default: null,
      type: cc.Node
    }, 
  },

  onLoad: function () {
    this.superTimeTxt.string = "0";
    this.intervalTime = 0;
    this.time = 0;
  },

  update: function (dt) {
    if(this.time > -1){
      this.intervalTime += dt;
      if(this.intervalTime > 1){
        this.intervalTime = 0;
        this.time--;
        this.superTimeTxt.string = this.time;
      }
    }
  },
  
  changePlayerStateNormal: function (){
    this.superTimeNode.active = false;
    this.intervalTime = 0;
  },

  changePlayerStateSuper: function (time){
    this.superTimeNode.active = true;
    this.intervalTime = 0;
    this.time = time;
    this.superTimeTxt.string = this.time;
  },
  

});
